<!--
  Copyright 2014 The Chromium Authors. All rights reserved.
  Use of this source code is governed by a BSD-style license that can
  be found in the LICENSE file.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="-1" />
    <script type="text/javascript" src="nacltest.js"></script>
    <title>Native Client Open Resource Before PPAPI Test</title>
  </head>

  <body>
    <h1>Native Client Open Resource Before PPAPI Test</h1>

  <script type="text/javascript">
    //<![CDATA[
function createModule(id, src, type) {
  return createNaClEmbed({
    id: id,
    src: src,
    width: 400,
    height: 400,
    type: type
  });
}
var mime = 'application/x-nacl';
if (getTestArguments()['pnacl'] !== undefined) {
  mime = 'application/x-pnacl';
}
var embed = createModule('naclModule', 'irt_manifest_file.nmf', mime);
embed.basic_tests ='2';
embed.stress_tests = '0';
document.body.appendChild(embed);

function setupTests(tester, plugin) {
  tester.addAsyncTest('Test_00_Init', function(status) {
    plugin.addEventListener('message', function(message_event) {
      this.removeEventListener('message', arguments.callee, false);
      // When a test succeeds, 'Pass' is returned. There are six test cases.
      var golden = ['Pass', 'Pass', 'Pass', 'Pass', 'Pass', 'Pass'];
      status.assertEqual(message_event.data, golden);
      status.pass();
    }, false);
    plugin.postMessage('hello');
  });
}

var tester = new Tester();
setupTests(tester, $('naclModule'));
tester.waitFor($('naclModule'));
tester.run();
    //]]>
  </script>
  </body>
</html>
